<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script  type="text/javascript" src="/js/vue.js"></script>
</head>
<body>
    <div id="root">
        姓：<input v-model = "firstName" />
        名：<input v-model = "lastName" />
        <div>{{firstName}}{{lastName}}</div>
        <div>{{fullName}}</div>
        <div>{{count}}</div>
    </div>
    <script>
        new Vue({
            el: "#root",

            data:{
               firstName: "",
                lastName: "",
                count: 0
            },
            computed:{
                fullName:function(){
                    return this.firstName+ ' '+this.lastName
                }
            },
            watch:{
                fullName:function(){
                    this.count++
                }
//                firstName:function(){
//                    this.count++
//                },
//                lastName: function(){
//                    this.count++
//                }
            }
        })
    </script>
</body>
</html>